﻿
@{
    ViewBag.Title = "Index";
}
<button v-on:click="edit('')" class="btn btn-default">新增</button>
<br/>
<table class="table table-responsive">
    <tr>
        <th>操作</th>
        <th>编码</th>
        <th>名称</th>
        <th>调用地址</th>
        <th>创建人</th>
        <th>是否启用</th>
    </tr>
    <tr v-for="n in list">
        <td><a v-on:click="edit(n.ID)" href="javascript:void(0)">编辑</a></td>
        <td>{{n.BusCode}}</td>
        <td>{{n.BusName}}</td>
        <td>{{n.Url}}</td>
        <td>{{n.UserName}}</td>
        <td>{{n.IsActive==1?"启用":"停用"}}</td>
    </tr>
</table>

@section script{
    <script>
        var vm = new Vue({
            el: "#app",
            data: {
                list: []
            },
            methods: {
                init: function() {
                    var ths = this;
                    $.post("@Url.Action("List", "Home")",
                        {},
                        function(res) {
                            ths.list = res;
                        });
                },
                edit: function(id) {
                    window.location.href = "/home/edit/"+id;
                }
            },
            created: function() {
                this.init();
            }
        });
    </script>
}

